home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Freeware / Pixload-2.2 / Pixload < prev   
Encoding:
Text File  |  2002-10-27  |  8.9 KB  |  297 lines

  1. /*
  2. ** $VER: Pixload 2.2
  3. ** www.Pixel-Art.fr.st
  4. */
  5.  
  6. call init
  7. call CreateApp(f)
  8. call HandleApp
  9.  
  10. /*never reached */
  11. /*************************************/
  12. init: procedure expose global. version
  13.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  14.     if AddLibrary("rxmui.library")~=0 then exit
  15.  
  16.     if ~show('L',"rexxtricks.library") then do
  17.           call addlib('rexxtricks.library',0,-30,0)
  18.     end
  19.     address command "Version >RAM:t/Version sys:libs/rxmui.library"
  20.     open(file,'RAM:t/Version', 'r' )
  21.         version=readln(file)
  22.     close(file)
  23.     address command 'delete >nil: ram:t/version'
  24.     version=word(version,2)
  25.     call rxmuiopt("debugmode showerr")
  26.     return
  27. /**********************************************************************************************/
  28. HandleApp: procedure expose programme. echantillon. volume son aide. visualiseur lecteur joueur
  29.     ctrl_c=2**12
  30.     do forever
  31.         call NewHandle("app","h",ctrl_c)
  32.         if and(h.signals,ctrl_c)>0 then exit
  33.         select
  34.             when h.event="QUIT" then exit
  35.             when h.event="APPEVENT" then call appFun(h.to,h.name)
  36.             otherwise interpret h.event
  37.         end
  38.     end
  39. /* never reached */
  40. /******************************************************************************************************/
  41. CreateApp: procedure expose programme. echantillon. son volume aide. version visualiseur lecteur joueur
  42.  
  43.      fenetre_info.Class="Win"
  44.      fenetre_info.dragbar=0
  45.      fenetre_info.borderless=1
  46.      fenetre_info.closegadget=0
  47.      fenetre_info.depthgadget=0
  48.      fenetre_info.sizegadget=0
  49.      fenetre_info.topedge=-1
  50.      fenetre_info.leftedge=-1
  51.  
  52.      fenetre_info.Contents="info_group"
  53.  
  54.        info_group.0="info_contenu"
  55.  
  56.         info_contenu.Class="text"
  57.         info_contenu.Font="Big"
  58.         info_contenu.Contents=ParseText("%3%c          Pixload version 2.2          ")
  59.  
  60.        info_group.1=hbar()
  61.        info_group.2=vspace(2)
  62.  
  63.        info_group.3="info_contenu_1"
  64.         info_contenu_1.Class="text"
  65.         info_contenu_1.Font="big"
  66.         info_contenu_1.Contents=""
  67.  
  68.     if NewObj("window","fenetre_info")>0 then exit
  69.  
  70.     /***********************************************/
  71.  
  72.     open(chemin,"Pixload:Prefs/Pixload.prefs",'Read')
  73.  
  74.     icones=readln(chemin)-1
  75.  
  76.     orientation=readln(chemin)
  77.     if orientation=1 then orientation=icones+1
  78.  
  79.     son=readln(chemin)
  80.     volume=readln(chemin)
  81.     taille=readln(chemin)
  82.     visualiseur=readln(chemin)
  83.     lecteur=readln(chemin)
  84.     joueur=readln(chemin)
  85.  
  86.     do num=0 to 14
  87.  
  88.        actif=readln(chemin)
  89.        programme.num="address command 'wbrun >nil: "||readln(chemin)||"'"
  90.  
  91.        aide.num=readln(chemin)
  92.        if aide.num="" then aide.num="???"
  93.  
  94.        echantillon.num=readln(chemin)
  95.        if echantillon.num="" then echantillon.num="pixload:sons/bip"
  96.  
  97.     end
  98.  
  99.     call close(chemin)
  100.  
  101.     /********************************************/
  102.  
  103.     app.Title="Pixload"
  104.     app.Version="$VER: Pixload version 2.2"
  105.     app.Author="Pixel Art - www.Pixel-Art.fr.st"
  106.     app.Description="Programs loading bar"
  107.     app.SubWindow="win"
  108.     app.Base="Pixload"
  109.  
  110.     win.Class="BWin"
  111.     win.nosize=1
  112.  
  113.     win.ID="MAIN"
  114.     win.AppWindow=1
  115.     win.Contents="barre_group"
  116.  
  117.     barre_group.0="sous_group"
  118.  
  119.          sous_group.class="Group"
  120.          sous_group.columns=orientation
  121.  
  122.     do i=0 to icones
  123.  
  124.        sous_group.i="icone_iff."i
  125.          icone_iff.i.class="gfxpic"
  126.          icone_iff.i.shorthelp=aide.i
  127.          icone_iff.i.source="Pixload:icones/"i
  128.          icone_iff.i.transparent=1
  129.          icone_iff.i.scale=taille
  130.          icone_iff.i.precision="image"
  131.          icone_iff.i.draw=1
  132.          icone_iff.i.inputmode="relverify"
  133.     end
  134.  
  135.     if NewObj("application","app")>0 then exit
  136.  
  137.     call add("app","fenetre_info")
  138.     call set("fenetre_info","open",1)
  139.  
  140.     if c2d(version)<842542640  then do       /* version 28.0 ou plus exigĂ©e */
  141.          call set("info_contenu","contents",parsetext("%3%cPixload needs RXMui 28.0 or more"))
  142.          call set("info_contenu_1","contents",parsetext("%3%c(detected version "version")"))
  143.          address command 'sys:c/wait 5'
  144.          exit
  145.     end
  146.  
  147.     if son=1 then
  148.            call set("info_contenu_1","contents",parsetext("%3%cSound enabled"))
  149.     else
  150.          call set("info_contenu_1","contents",parsetext("%3%cSound disabled"))
  151.  
  152.     address command 'sys:c/wait 2'
  153.  
  154.     call domethod("win","adduseritem","Pixload's Prefs",1)
  155.     call domethod("win","adduseritem","Sound - On/Off",2)
  156.     
  157.     call notify("win","useritem",1,"app","return","call prefs")
  158.     call notify("win","useritem",2,"app","return","call son")
  159.     
  160.     do i=0 to icones
  161.        call Notify("icone_iff."i,"pressed",1,"app","Return","call dofun("i")")
  162.     end
  163.  
  164.     call Notify("win","CloseRequest",1,"app","ReturnID","quit")
  165.  
  166.     do i=0 to icones
  167.        call AppMessage("icone_iff."i)
  168.     end
  169.  
  170.     call set("win","open",1)
  171.  
  172.     if son=1 then do
  173.        addlib('rexxsupport.library',0,-30,0)
  174.        address command 'run sys:c/gcsound'
  175.        address 'gcsound'
  176.        sound "pixload:Sons/diag" 1 volume/1.5625
  177.     end
  178.  
  179.     call set("info_contenu_1","contents",parsetext("%3%cDiagnostic complete"))
  180.  
  181.     if son=1 then address command 'sys:c/wait 3'
  182.     else address command 'sys:c/wait 1'
  183.     call set("fenetre_info","open",0)
  184.  
  185. return
  186. /***************/
  187. prefs: procedure
  188.  
  189.     call set("fenetre_info","open",1)
  190.     call set("info_contenu_1","contents",Parsetext("%3%cPixload Prefs 2.2"))
  191.  
  192.     address command 'wbrun sys:prefs/pixload-prefs'
  193.     address command 'sys:c/wait 1'
  194.     call set("fenetre_info","open",0)
  195.  
  196. return
  197. /********************************/
  198. son: procedure expose son volume
  199.  
  200.   if son=1 then do
  201.        son=0
  202.        call set("info_contenu_1","contents",parsetext("%3%cSound disabled"))
  203.   end
  204.   else do
  205.        son=1
  206.        call set("info_contenu_1","contents",parsetext("%3%cSound enabled"))
  207.        addlib('rexxsupport.library',0,-30,0)
  208.        address command 'run sys:c/gcsound'
  209.        address 'gcsound'
  210.        sound "pixload:Sons/1" 1 volume/1.5625
  211.   end
  212.  
  213.   call set("fenetre_info","open",1)
  214.   address command 'sys:c/wait 1'
  215.   call set("fenetre_info","open",0)
  216.  
  217. return
  218. /****************************************************************/
  219. dofun: procedure expose programme. echantillon. son aide. volume
  220.  
  221.     parse arg a
  222.  
  223.     if son=1 then
  224.  
  225.     do
  226.       address 'gcsound'
  227.       sound echantillon.a 1 volume/1.5625
  228.     end
  229.  
  230.     call set("fenetre_info","open",1)
  231.     call set("info_contenu_1","contents",Parsetext("%3%c"aide.a))
  232.     address command 'sys:c/wait 1'
  233.     call set("fenetre_info","open",0)
  234.  
  235.     cmd=programme.a
  236.     interpret cmd
  237.  
  238. return
  239. /****/
  240. halt:
  241.     break=_c:
  242.     exit
  243. /******************************************************************/
  244. appFun: procedure expose programme. visualiseur lecteur joueur aide.
  245.  
  246. parse arg to,what
  247.  
  248.     filet=whatis(what)
  249.  
  250.     if filet="Volume" then do
  251.          call set("fenetre_info","open",1)
  252.          call set("info_contenu_1","contents",Parsetext("%3%cEjection "what))
  253.          address command 'sys:c/eject "'||what||'"'
  254.          address command 'wait 1'
  255.          call set("fenetre_info","open",0)
  256.     end
  257.  
  258.     else do
  259.          numero=right(to,length(to)-10)
  260.          if (numero=0 | numero=1 | numero=2) then do
  261.             call set("fenetre_info","open",1)
  262.             call set("info_contenu_1","contents",Parsetext("%3%c%b"aide.numero))
  263.             address command 'sys:c/wait 1'
  264.             call set("fenetre_info","open",0)
  265.             what=insert('"',insert('"',what,length(what)))
  266.             cmd=left(programme.numero,length(programme.numero)-1) what"'"
  267.             interpret cmd
  268.          end
  269.          else do
  270.               select
  271.                   when filet="GIF"      then extension=visualiseur
  272.                   when filet="JPEG"     then extension=visualiseur
  273.                   when filet="PNG"      then extension=visualiseur
  274.                   when filet="PSD"      then extension=visualiseur
  275.                   when filet="8SVX"     then extension="sys:c/dsound -2 -f"
  276.                   when filet="IFF"      then extension=visualiseur
  277.                   when filet="ILBM"     then extension=visualiseur
  278.                   when filet="ILBM24"   then extension=visualiseur
  279.                   when filet="Rexx"     then extension=lecteur
  280.                   when filet="Text"     then extension=lecteur
  281.                   when filet="Mod"      then extension=joueur
  282.                   when filet="Module"   then extension=joueur
  283.                   when filet="Modules"  then extension=joueur
  284.                   when filet="MP3"      then extension="rxs sys:s/start-amplifier"
  285.                   when filet="Unknown"  then filet="non reconnu"
  286.                   otherwise extension="sys:utilities/multiview"
  287.               end
  288.               call set("fenetre_info","open",1)
  289.               call set("info_contenu_1","contents",Parsetext("%3%ctype : "filet))
  290.               address command 'sys:c/wait 1'
  291.               call set("fenetre_info","open",0)
  292.               if filet~=="non reconnu" then address command 'run '||extension '"'||what||'"'
  293.          end
  294.     end
  295. return
  296.  
  297.